package com.zjm.structural.bridge.jdbc;

/**
 * 抽象部分：数据库连接
 */
public abstract class DatabaseConnection {
    protected DatabaseDriver driver;
    protected String url;
    protected String username;
    protected String password;

    public DatabaseConnection(DatabaseDriver driver, String url, String username, String password) {
        this.driver = driver;
        this.url = url;
        this.username = username;
        this.password = password;
    }

    public void connect() {
        driver.connect(url, username, password);
    }

    public abstract void executeQuery(String sql);

    public void close() {
        driver.close();
    }
}
